<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FloatNavigate</title>
<link rel="stylesheet" type="text/css" href="CSS/cssAll.css"/>
<link rel="stylesheet" type="text/css" href="CSS/floatNavigate.css"/>
</head>

<body>
<div class="top"></div>
<ul id="nav" class="navigate">
	<li id=m1-ddheader onMouseOver=ddMenu('m1',1) onmouseout=ddMenu('m1',-1)><a href="#">导航1</a>
		<ul id=m1-ddcontent onMouseOver=cancelHide('m1') onmouseout=ddMenu('m1',1)>
			<li><a href="#">子菜单1</a></li>
			<li><a href="#">子菜单1</a></li>
			<li><a href="#">子菜单1</a></li>
			<li><a href="#">子菜单1</a></li>
		</ul>
	</li>
	<li id=m2-ddheader onMouseOver=ddMenu('m2',1) onmouseout=ddMenu('m2',-1)><a href="#">导航2</a>
		<ul id=m2-ddcontent onMouseOver=cancelHide('m2') onmouseout=ddMenu('m2',1)>
			<li><a href="#">子菜单2</a></li>
			<li><a href="#">子菜单2</a></li>
			<li><a href="#">子菜单2</a></li>
			<li><a href="#">子菜单2</a></li>
			<li><a href="#">子菜单2</a></li>
		</ul>
	</li>
</ul>
</body>
</html>
<script src="JS/func.js" language="javascript"></script>
<script src="JS/showPrint.js" language="javascript"></script>
<script language="javascript">
var nSpeed = 10;
var dTime = 15;
// main function to handle the mouse events //
function ddMenu(id,d)
{
    var h = document.getElementById(id + '-ddheader');
    var c = document.getElementById(id + '-ddcontent');
    clearInterval(c.timer);
    if(d == 1)
    {
        clearTimeout(h.timer);
        if(c.maxh && c.maxh <= c.offsetHeight)
        {
            return;
        }
        else if(!c.maxh)
        {
            c.style.top = '-' + c.offsetHeight + 'px';
            c.style.display = 'block';
            c.style.height = 'auto';
            c.maxh = c.offsetHeight;
            c.style.height = '0px';
        }
        c.timer = setInterval(function(){ddSlide(c,1);},dTime);
    }
    else
    {
        h.timer = setTimeout(function(){ddCollapse(c)},50);
    }
}
// collapse the menu //
function ddCollapse(c){
	c.timer = setInterval(function(){ddSlide(c,-1)},dTime);
}
// cancel the collapse if a user rolls over the dropdown cent //
function cancelHide(id){
	var h = document.getElementById(id + '-ddheader');
	var c = document.getElementById(id + '-ddcontent');
	clearTimeout(h.timer);
	clearInterval(c.timer);
	if(c.offsetHeight < c.maxh){
		c.timer = setInterval(function(){ddSlide(c,1)},dTime);
	}
}
// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
	var currh = c.offsetHeight;
	var dist;
	if(d == 1){
		dist = (Math.round((c.maxh - currh) / nSpeed));
	}else{
		dist = (Math.round(currh / nSpeed));
	}
	if(dist <= 1 && d == 1){
		dist = 1;
	}
	c.style.top = parseInt(c.style.top.replace('px','')) - parseInt(dist * d) + 'px';
	c.style.height = currh + (dist * d) + 'px';
	if(getOs()=="Firefox")
	{	
		c.style.opacity = currh / c.maxh;
	}
	c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
	if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
		clearInterval(c.timer);
	}
}
function getOs() 
{ 
   var OsObject = ""; 
   if(navigator.userAgent.indexOf("MSIE")>0) { 
        return "MSIE"; 
   }
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
        return "Firefox"; 
   } 
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
        return "Safari"; 
   }  
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
        return "Camino"; 
   } 
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
        return "Gecko"; 
   } 
} 
</script>
